<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绝大多数数据是通过构造函数方式创建的</title>
</head>
<body>
    <script>
        let obj = new Object({name:"xiaxia"});
        console.log(obj);

        let arr = new Array(1,2,3);
        console.log(arr);

        let number = new Number(1);
        console.log(number);
        console.log(number.valueOf());

        let str = new String('xiasnn');
        console.log(str);
        console.log(str.valueOf());
        console.log(str.toUpperCase());

        let boolean = new Boolean(true);
        console.log(boolean.valueOf());
        console.log(boolean.toString());

        let date = new Date();
        console.log(date.valueOf());

        let zz = new RegExp('\\d+');
        console.log(zz.valueOf());
        console.log(zz.test(54645));

        function hd (){}
        console.log(hd.constructor);


        // let User = new Function(
        //     'name',
        //     `
        //     this.name = name,
        //     this.show = function(){
        //         console.log(this.name);
        //     }
        //     `
        // );
        let User = hd.constructor(
            'name',
            `
            this.name = name,
            this.show = function(){
                console.log(this.name);
            }
            `
        );
        console.log(User);
        let lisi = new User('李四');
        lisi.show();
    </script>
</body>
</html>